ref class Bar;
delegate void HistoryBarsCompletedDel();
delegate void ReadTimeBarAddedDel( Bar ^barInformation );

ref class Bars
{
public:
	event HistoryBarsCompletedDel^ HistoryBarsCompleted;
	event ReadTimeBarAddedDel^ ReadTimeBarAdded;

	int Count() { return currentBar; }

	void ReqHistoryBars(String ^date);
	void ReqHistoryBars();
	void ReqRealTimeBars();

	void AddBar(Bar ^bar);
	Bars(Symbol ^owner);
	Bar^ operator[](int index);

protected:
	Symbol ^owner;
	array<Bar^> ^bar;
	int currentBar;

	void getHistoryBars(System::Object ^sender, AxTWSLib::_DTwsEvents_historicalDataEvent ^e);
	int historyBarsID;
	void getRealTimeBars(System::Object ^sender, AxTWSLib::_DTwsEvents_realtimeBarEvent ^e);
	int realTimeBarsID;
	float tmpBarHigh; float tmpBarLow; float tmpBarOpen;
	bool requestedHistory;
};


ref struct Bar
{
	float Open;
	float Close;
	float High;
	float Low;
	String ^Time;
};